#! /usr/bin/env python
# coding=utf8
# this program just a GUI
# the program core is paste@ubuntu, it can paste data to paste, view data from paste

try:
    import pygtk
except ImportError:
    print "no pygtk"
    raise SystemExit

pygtk.require('2.0')
import gtk

# import the program core (this script just the gui)
try:
    from pasteUbuntu import main
except ImportError:
    print "can not find the core(pasteUbuntu.py)"
    raise SystemExit

class mainWindow():
    """Program's main window"""
    def __init__(self):
        self.window = gtk.Window()
        self.window.set_title('PyGTK')
        self.window.set_default_size(500, 699)
        self.window.connect('destroy', self.quit)
        label = gtk.Label('===============================')
        box = gtk.VBox(False, 5)
        box.pack_start(label, False, False, 5)
        # show a list
        self.showList(box)
        self.window.add(box)
        label.show()
        box.show()
        self.window.show()
        gtk.main()

    def quit(self, widget, data=None):
        """Exit Program"""
        gtk.main_quit()

    def showList(self, box):
        main("list", None)
        label_list = []
        for i in range(10):
            tmp_label = gtk.Label(i)
            label_list.append(tmp_label)
            box.pack_start(label_list[i], False, False, 5)
            label_list[i].show()


# Program Start
if __name__ == '__main__':
    mainWindow()
